﻿using Architecture.Domian.Common;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Architecture.Domain.TraceabilityManage
{
    /// <summary>
    /// 屠宰表
    /// </summary>
    [Table("Slaughter")]
    public class Slaughter : AuditInfo
    {
        /// <summary>
        /// 屠宰Id
        /// </summary>
        [Key]
        public int SId { get; set; }

        /// <summary>
        /// 生产批次
        /// </summary>
        [StringLength(50)]
        public string? ProductionLot { get; set; }

        /// <summary>
        /// 到厂均重
        /// </summary>
        [Column(TypeName = ("decimal(10,2)"))]
        public decimal WeightToFactory { get; set; }

        /// <summary>
        /// 到厂时间
        /// </summary>
        public DateTime? ArrivalTime { get; set; }

        /// <summary>
        /// 到厂时间
        /// </summary>
        [NotMapped]
        public string? ArrivalDateTime
        {
            get { return ArrivalTime == null ? null : Convert.ToDateTime(ArrivalTime).ToString("yyyy年MM月dd日 HH:mm:ss"); }
        }

        /// <summary>
        /// 屠宰时间
        /// </summary>
        public DateTime? SlaughterTime { get; set; }

        /// <summary>
        /// 屠宰时间
        /// </summary>
        [NotMapped]
        public string? SlaughterDateTime
        {
            get { return SlaughterTime == null ? null : Convert.ToDateTime(SlaughterTime).ToString("yyyy年MM月dd日 HH:mm:ss"); }
        }

        /// <summary>
        /// 相关资质
        /// </summary>
        [StringLength(1000)]
        public string? RelevantQualification { get; set; }

        /// <summary>
        /// 屠宰公司
        /// </summary>
        public int SlaughteringCompanyId { get; set; }
    }
}
